﻿#define _CRT_SECURE_NO_WARNINGS
#include<iostream>
using namespace std;

class BaseStatic
{
public:
	static void func()
	{
		cout << "BaseStatic的func()！" << endl;
	}
	static void func(int a)
	{
		cout << "BaseStatic的func(int a)！" << endl;
	}

	static int static_A;
};
int BaseStatic::static_A = 10;

class SonStatic :public BaseStatic
{
public:
	static void func()
	{
		cout << "SonStatic的func()！" << endl;
	}

	static int static_A;
};
int SonStatic::static_A = 20;

//1.静态成员属性，子类可以继承下来；
void testExtendsStatic()
{
	cout << SonStatic::static_A << endl;//10 --> 20

	//2.访问父类的static_A；
	cout << BaseStatic::static_A << endl;//10

	SonStatic::func();//SonStatic的func()！
	//3.访问父类中同名的函数；
	SonStatic::BaseStatic::func(30);//BaseStatic的func(int a)！
}

//main290：继承中静态成员的处理
int main290()
{
	testExtendsStatic();

	system("pause");
	return EXIT_SUCCESS;
}